<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/auth/templates/template.xhtml">
	<ui:define name="pageTitle">Lista de Despesas</ui:define>
	<ui:define name="body">
		<f:view>
			<p:growl id="messages" autoUpdate="true" closable="true" />
			<h:form>
				<h:panelGrid cellspacing="10px" styleClass="center">
					<f:facet name="header">Lista de Despesas</f:facet>
					<h:panelGrid cellspacing="10px">
						<h:panelGrid columns="2" cellspacing="10px">
							<h:outputText value="Total em Despesas:" />
							<h:outputText value="#{despesaRSBean.saldoDespesas}">
								<f:convertNumber currencyCode="BRL" type="currency" />
							</h:outputText>
						</h:panelGrid>
						<h:outputText
							value="Não incluso despesas com cartão de crédito de compra" />
						<p:dataTable var="despesa"
							value="#{despesaRSBean.despesasSemCartao}"
							emptyMessage="Não existem registros para esta tabela"
							paginator="true" rows="10"
							paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
							rowsPerPageTemplate="5,10,15">
							<p:column headerText="Id">
								<h:outputText value="#{despesa.idDespesa}" />
							</p:column>
							<p:column headerText="Descrição">
								<h:outputText value="#{despesa.descricao}" />
							</p:column>
							<p:column headerText="Valor">
								<h:outputText value="#{despesa.valor}">
									<f:convertNumber currencyCode="BRL" type="currency" />
								</h:outputText>
							</p:column>
							<p:column headerText="Dia Vencimento">
								<h:outputText value="#{despesa.diaVencimento}" />
							</p:column>
							<p:column headerText="Ação">
								<p:commandButton icon="ui-icon-search" title="Detalhes"
									action="consultardespesa?faces-redirect=true&amp;includeViewParams=true">
									<f:setPropertyActionListener target="#{despesaRSBean.despesa}"
										value="#{despesa}" />
								</p:commandButton>
								<p:commandButton icon="ui-icon-arrowreturnthick-1-e"
									title="Incluir Pagamento de Despesa"
									action="incluirpagamentodespesa?faces-redirect=true&amp;includeViewParams=true">
									<f:setPropertyActionListener target="#{despesaRSBean.despesa}"
										value="#{despesa}" />
								</p:commandButton>
								<p:commandButton icon="ui-icon-pencil" title="Alterar Dados"
									action="alterardadosdespesa?faces-redirect=true&amp;includeViewParams=true">
									<f:setPropertyActionListener target="#{despesaRSBean.despesa}"
										value="#{despesa}" />
								</p:commandButton>
							</p:column>
							<p:column headerText="Remover">
								<p:commandButton
									actionListener="#{despesaRSBean.remover(despesa)}"
									onclick="if(!confirm('Deseja realmente remover esta despesa?')) return false;"
									icon="ui-icon-trash" title="Remover" update="@form" />

							</p:column>
						</p:dataTable>
					</h:panelGrid>
				</h:panelGrid>
			</h:form>
		</f:view>
	</ui:define>
</ui:composition>

</html>